package youcaihuaoa.weetop.com.ui.main

import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.gyf.immersionbar.ImmersionBar
import com.robot.base.base.activity.GLBaseActivity
import com.robot.base.configs.AppConstants
import com.robot.base.util.arouter.ARouterUtil
import youcaihuaoa.weetop.com.BR
import youcaihuaoa.weetop.com.R
import youcaihuaoa.weetop.com.databinding.AppActivityNotifyMessageBinding
import youcaihuaoa.weetop.com.databinding.AppActivityWagesBinding
import youcaihuaoa.weetop.com.databinding.AppActivityWagesProfileBinding
import youcaihuaoa.weetop.com.ui.adapter.NotifyItemAdapter
import youcaihuaoa.weetop.com.ui.adapter.WagesItemAdapter
import youcaihuaoa.weetop.com.ui.adapter.WagesProfileItemAdapter
import youcaihuaoa.weetop.com.vm.main.NotifyMessageViewModel
import youcaihuaoa.weetop.com.vm.main.WagesProfileViewModel
import youcaihuaoa.weetop.com.vm.main.WagesViewModel

@Route(path = AppConstants.Router.Main.A_WAGES_PROFILE)
class WagesProfileActivity :
    GLBaseActivity<AppActivityWagesProfileBinding, WagesProfileViewModel>() {

    private lateinit var wagesProfileItemAdapter1: WagesProfileItemAdapter

    private lateinit var wagesProfileItemAdapter2: WagesProfileItemAdapter

    override fun initComponents() {
        addSingleTitleBar("我的工资")
        wagesProfileItemAdapter1 = WagesProfileItemAdapter()
        binding.recyclerView1.apply {
            layoutManager = LinearLayoutManager(this@WagesProfileActivity)
            adapter = wagesProfileItemAdapter1
        }
        wagesProfileItemAdapter2 = WagesProfileItemAdapter()
        binding.recyclerView2.apply {
            layoutManager = LinearLayoutManager(this@WagesProfileActivity)
            adapter = wagesProfileItemAdapter2
        }
    }

    var id = ""
    override fun initParam() {
        super.initParam()
        id = intent.getStringExtra(AppConstants.BundleKey.ID)?:""
    }
    override fun initData() {
        viewModel.initMenu(id)
    }



    override fun initViewObservable() {
        viewModel.uiEvent.menuDataLiveEvent.observe(this) {
            wagesProfileItemAdapter1.setNewInstance(it)
        }
        viewModel.uiEvent.menu2DataLiveEvent.observe(this) {
            wagesProfileItemAdapter2.setNewInstance(it)
        }
    }

    override fun initContentView(savedInstanceState: Bundle?): Int =
        R.layout.app_activity_wages_profile

    override fun initVariableId(): Int = BR.viewModel
}